#include "eigen/fashion_mnist_load_test.h"
#include "eigen/fashion_mnist_load.h"
#include "log.h"

namespace  ldl_eigen
{
void FashionMnistLoadTest::test()
{
    FashionMnistLoad fashion_mnist_load("../../data/FashionMnist/");
    fashion_mnist_load.load();

    // 打印第一张图像和标签
    LogInfo() << "标签: " << static_cast<int>(fashion_mnist_load.get_train_labels()[4]);
    Eigen::MatrixXi train_images = fashion_mnist_load.get_train_images();
    print_image(train_images.row(4));
}

// 打印单张图像（ASCII艺术）
void FashionMnistLoadTest::print_image(const Eigen::VectorXi& img, int rows, int cols)
{
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < cols; ++j) {
            uint8_t pixel = img[i * cols + j];
            std::cout << (pixel > 128 ? "██" : "  ");
        }
        std::cout << "\n";
    }
}
}